home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / see265.zip / SEEMEM.DOC < prev    next >
Text File  |  1993-01-16  |  15KB  |  307 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.                                    SEEMEM.EXE 
  9.                                   Version 2.65
  10.                                   January, 1993
  11.  
  12.  
  13.  
  14.         Author:   Tedrick A. Housh, Jr.
  15.                   5811 West 85th Terrace
  16.                   Overland Park, KS 66207 
  17.  
  18.  
  19.  
  20.         Electronic Mail: CompuServe 72466,212
  21.                          Genie      R.HOUSH 
  22.  
  23.  
  24.  
  25.         The objective of SEEMEM is to display information about the
  26.         current use of MS-DOS memory by the operating system, and
  27.         resident processes and data.
  28.  
  29.         It is designed to make full use of the new memory facilities
  30.         provided by DOS version 5.0, and to provide information similar
  31.         to that provided by the DOS utility MEM.  However, it provides
  32.         this information even when DOS does not control Upper or Extended
  33.         memory, and even when HIMEM.SYS and EMM386.EXE are not loaded,
  34.         and recognizes UMB's created by other programs, such as
  35.         Quarterdeck Software's QEMM386 (for 386 and higher) and QRAM (for
  36.         286 cpu's with EMS version 4.00 hardware or Chips and
  37.         Technologies Shadow Ram).  It works with these programs on all
  38.         versions of DOS greater than 1, and on all CPU chips, 8088 and
  39.         higher, although the memory detail displayed increases with
  40.         increase in CPU version.  As of SeeMem version 2.00, it provides
  41.         full support for DR-DOS 6.00 also, and with version 2.65 for
  42.         Qualitas' 386Max, and Helix Software's NetRoom. 
  43.  
  44.         SEEMEM was written in Turbo Pascal 6.00, as an exercise in the
  45.         use of the Built-In Assembler (BASM).  In that connection, all
  46.         necessary DOS functions were specifically coded in BASM, as were
  47.         all functions which necessarily interface with the extended
  48.         memory (XMS) driver provided by HIMEM.SYS, or its counterparts
  49.         such as QEMM386.SYS, or QEXT.SYS, or EMM386.SYS. This completely
  50.         eliminates the need for the Turbo Pascal DOS unit, or a unit to
  51.         interface with the XMS and UMB device drivers. All the low level
  52.         functions necessary for this purpose are included directly in the
  53.         SEEMEM.PAS file as BASM code, and the .PAS file is independent
  54.         and completely self-supporting. 
  55.  
  56.         The display output for SEEMEM is in three parts.  The first part,
  57.         which may include several screen pages, displays every memory
  58.         control block (MCB) between Segment 0 and the top of conventional
  59.         memory (Segment 9FFFh on a 640k machine), and also between the
  60.         top of conventional memory and the start of the High Memory Area
  61.  
  62.                                         1
  63.  
  64.  
  65.  
  66.  
  67.         (HMA) if any, or the top of Upper Memory (Segment 0FFFFh).  For
  68.         each MCB SEEMEM displays its segment address (in hex), its size
  69.         (in  bytes), the segment of its "owner," its "parent" (i.e. the
  70.         MCB of the program that loaded it), its type (e.g. TSR or
  71.         Environment), and its name (if determinable). 
  72.  
  73.         The second part is a display of EMS (Expanded Memory) if
  74.         applicable.  This displays the version number of the EMS device
  75.         driver, the page frame segment, the total size of the installed
  76.         EMS memory, the number of mapping register sets available,
  77.         whether or not nonvolatile handles (will survive warm boot) are
  78.         available, the number of DMA channels , the maximum number of EMS
  79.         handles supported, the number of free handles, free pages, page
  80.         size, and free memory, and for each handle in use, the handle
  81.         number, the number of EMS pages, the page size, the memory used,
  82.         and if available, the handle name.  This second part may occupy
  83.         more than one screen page. 
  84.  
  85.         The third part displays XMS information (if a driver is
  86.         installed), including XMS version number, revision number, the
  87.         XMM Control Vector in segment:offset form, total XMS free memory,
  88.         and largest free XMS block.  With respect to the High Memory Area
  89.         (HMA) SEEMEM shows whether the A20 line is currently enabled,
  90.         whether HMA is implemented, whether the HMA is available for use.
  91.         If the DOS version is 5.00 or greater SEEMEM also will say
  92.         whether DOS is resident in the HMA (DOS=HIGH in config.sys), and,
  93.         if so, how much of the HMA DOS has left available for additional
  94.         buffers, etc.  SEEMEM also displays the location of DOS when it
  95.         is located elsewhere (i.e. ROM or Conventional memory). 
  96.  
  97.         The third part also displays information about Upper Memory
  98.         Blocks (UMB's) if available:  whether UMB's are implemented,
  99.         whether they are controlled by device driver or by DOS itself
  100.         (with DOS 5.00 and higher), whether UMB's are linked to
  101.         conventional memory (DOS 5.00) or are independent, and whether
  102.         UMB's are implemented by DOS=UMB in CONFIG.SYS (DOS 5.00). 
  103.  
  104.         Seemem does NOT display device driver information loaded under
  105.         DOS version 4.xx or higher's "secondary" MCB's, although it will
  106.         display such primary MCB's other software may use to load such
  107.         device driver's "high" in UMB's if each is given its own MCB.
  108.         This was a design decision to avoid "clutter."  Plenty of
  109.         programs are available to "walk" the device chain and display
  110.         this information. 
  111.  
  112.         A word about resident code names is in order. Under DOS 2.xx the
  113.         name of resident loading programs is not determinable.  With DOS
  114.         3.xx the name may be determined from the environment, unless that
  115.         was released back to DOS's pool on installation.  With DOS 4.xx
  116.         and higher an eight character name is inserted in the last eight
  117.         bytes of the 16 byte MCB, and therefore is always available. Some
  118.         other programs which control UMB's insert the eight character
  119.         name in the MCB under any DOS version, but this is not used by
  120.         SEEMEM.  SEEMEM uses the most detailed information available
  121.         through DOS.  Therefore, if the DOS version is 4 or higher, and
  122.  
  123.                                         2
  124.  
  125.  
  126.  
  127.  
  128.         the environment pertaining to the process is still resident, the
  129.         program name and extension is taken from the environment
  130.         (although the drive and directory information is stripped from
  131.         the filename before display). 
  132.  
  133.         A full explanation of the XMS, UMB, and HMA standards is not
  134.         within the scope of this documentation, however an understanding
  135.         of a few of the more obscure facts will help understand SEEMEM's
  136.         operation.   The "XMS Specification" for extended memory is
  137.         similar to the EMS spec for expanded memory.  It provides
  138.         functions for implementing use of extended memory with handles in
  139.         a manner very much the same as EMS does for expanded memory.  The
  140.         High Memory Area (HMA) is the 64 kilobyte (less 16 bytes) just
  141.         above the 1 megabyte limit of the 8086 and 8088 chips. Obviously,
  142.         then XMS extended memory and the HMA require a 80286 chip or
  143.         higher.  However, through a clever addressing scheme, and an
  144.         additional hardware address line, an 80286 or higher can address
  145.         the HMA in "real" mode, i.e. as "non-extended" memory. Although
  146.         XMS drivers existed before DOS 5.00, and some alternative
  147.         DOS-like operating systems allowed the use of this space for some
  148.         things, DOS 5.00 now allows DOS itself to be loaded there,
  149.         substantially increasing the possible useable memory space in
  150.         lower memory previously used by DOS. 
  151.  
  152.         Although the protocols and specifications for Upper Memory Blocks
  153.         (UMB's) are contained in the original XMS specifications, they
  154.         are NOT necessarily part of the XMS driver itself, and in fact
  155.         were not implemented by the first MicroSoft driver, HIMEM.SYS.
  156.         The XMS specification only provides one control vector however,
  157.         so if all UMB calls need be implemented through that vector, a
  158.         UMB driver must be integrated with the XMS driver, or must hook
  159.         that vector (necessarily implying that it must be loaded after
  160.         the XMS driver has installed the vector) unless it is completely
  161.         integrated.  However DOS 5.00 has supplied interrupt 21h function
  162.         calls to manipulate the use of existing UMB's for detecting the
  163.         existence, state and governing the rules of use of UMB's, and
  164.         these function calls are not dependent on the existence of any
  165.         device driver, nor for that matter, the existence of any extended
  166.         memory, or a chip higher than that 8088-8086.  The thought may
  167.         take some getting used to, but this means that UMB's can exist
  168.         without any driver or control vector at all.  In fact there is at
  169.         least one program available which acts as though it were a device
  170.         driver, creates UMB's from the shadow ram available through some
  171.         motherboard chipset implementations, hands it over to DOS, and
  172.         then just aborts, itself disappearing from memory.  DOS then
  173.         owns, and makes available some UMB's with no device driver to
  174.         control them.  SEEMEM can also detect this type of UMB and
  175.         display its state. 
  176.  
  177.         DOS 5.00 provides greatly increased support for XMS, HMA, and
  178.         UMB's, and SEEMEM uses all of it, where it is possible to do so.
  179.  
  180.         In order that it may support full display redirection SEEMEM does
  181.         not do any direct video memory-mapped display.  All display is
  182.         through DOS or BIOS.  Each screen is paged with a "MORE" line at
  183.  
  184.                                         3
  185.  
  186.  
  187.  
  188.  
  189.         the bottom UNLESS the /N ("NO PAUSE") switch is used.  Another
  190.         switch available is the help /H or /? switch, which displays a
  191.         simple help message.  The output may be directed to a file or a
  192.         device such as a printer, in which case you will probably wish to
  193.         bypass paging also, with the /n switch.  As of SeeMem version
  194.         2.00 SeeMem detects this redirection and turns paging off by
  195.         itself.
  196.  
  197.         For example SEEMEM /N > PRN  would send the output of the program
  198.         to the printer for a permanent record.  In order to speed the
  199.         output slightly the DOS IOCTL function is used to switch to "raw"
  200.         output mode, and is returned to its prior state, probably
  201.         "cooked," upon program termination.  This speeds up output by
  202.         eliminating checks for ^S, ^Q, ^C and expansion of tabs, etc., so
  203.         you cannot manually pause the program or "break" it.  No tabs or
  204.         other characters requiring interpretation are used however, so
  205.         you should see no difference due to disallowance of "cooked"
  206.         mode. 
  207.  
  208.         If you insist on a "scrollable" output I have successfully used
  209.         the J.P. Software's 4DOS command shell internal LIST command with
  210.         SEEMEM to provide this with the following command line: 
  211.  
  212.         SEEMEM /N | LIST /S 
  213.  
  214.         This provides an output which uses LIST to scroll from top to
  215.         bottom. 
  216.  
  217.         I have made the source code available in Turbo Pascal 6.0 on the
  218.         Borland Support area on GEnie and in the Borland Programming Area
  219.         on CompuServe.  The program is copyright but donated to the
  220.         public domain without any restriction, except that it be
  221.         distributed in its original form with appropriate authorship
  222.         credit, with no charge other than reasonable fees for duplication
  223.         and distribution, including by electronic means.  It is
  224.         specifically intended and permission is granted for distribution
  225.         by commercial electronic sources for their regular and customary
  226.         access and membership fees even though they may be operated for
  227.         profit.  No warranties of any kind accompany SEEMEM, and the
  228.         author assumes no responsibility for any consequences of its use,
  229.         either direct or consequential.
  230.  
  231.         The basic idea for SEEMEM is not new, of course and all parts of
  232.         it borrow heavily upon prior, similar programs.  Perhaps it
  233.         should be named YAMEM (Yet Another MEMory display program).
  234.         Nevertheless it does do some things no other does (that I know
  235.         of) and it is a demonstration of Turbo Pascal 6's BASM facility
  236.         which clearly shows the practicality of the TP environment for
  237.         low level system programming.  In fact, I don't think the same
  238.         thing could be done in C with faster or smaller code resulting.
  239.         Yeah, I know, TP is primarily a shell for the assembly stuff, but
  240.         at least it can do that now, and very adroitly, too.
  241.  
  242.                                New in Version 2.65
  243.  
  244.  
  245.                                         4
  246.  
  247.  
  248.  
  249.  
  250.         Since version 2.0, a number of fixes have been made, support for
  251.         MS-DOS 5.00, DR-DOS 6.00, and 4DOS 4.xx has been expanded
  252.         considerably.  In addition adjustments have been made for Windows
  253.         3.10 enhanced mode.
  254.  
  255.         Most of the fixes were necessary because arithmetic has never
  256.         been my forte' and calculations of block sizes, etc. were not
  257.         quite accurate enough.  Most user's apparently didn't notice but
  258.         a few did call my attention to this, for which I thank them.
  259.  
  260.         Two switches were added, /L for "Long" which sets the page length
  261.         in each section of the report to 55 lines so that redirection to
  262.         the printer will look better, and /C which allows displays of
  263.         control and "high order" characters which are ordinarily
  264.         automatically converted to something any printer can handle. 
  265.         SEEMEM now automatically detects redirection and turns off
  266.         pausing when the output is redirected to anything but the
  267.         standard output (normally the screen).
  268.  
  269.         The owner names were changed somewhat.  Most are self explanatory
  270.         to those who need the information.  "TSR" represents a resident
  271.         program (if it's resident it's really a "process").
  272.  
  273.         Support has been added for Quarterdeck's QEMM and QRAM, Qualitas'
  274.         386Max, and Helix's NetRoom.  Varying degrees of detail are
  275.         gleaned from these memory managers.  Staying as generic as
  276.         possible requires some compromises.
  277.  
  278.         There were a number of other technical changes since version 2.00
  279.         which are mentioned in SEEMEM's history file SEEMEM.HST, which
  280.         accompanies this documentation.
  281.  
  282.         Source code (Turbo Pascal 6.0) is available by sending a blank,
  283.         formatted disk and appropriately sized SASE to the above address,
  284.         or may be downloaded from the Borland Turbo Pascal Forum on
  285.         CompuServe Information Service (search for keyword SEEMEM265).
  286.  
  287.         Enjoy,
  288.  
  289.                Rick Housh
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.                                         5
  307.